import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    breadcrumbList: [],
  },
  mutations: {
      addList(state,path){

        state.breadcrumbList.splice(0,1,{name:path})


      },
      deleteList(state){
           state.breadcrumbList.splice(0,1,[])
      }
  },
  actions: {

  },
  getters:{
      breadcrumbList:state=>{
        let breadcrumbList =state.breadcrumbList
        if (breadcrumbList.length==0) {
             breadcrumbList=JSON.parse(sessionStorage.getItem('breadcrumbList')||null)
        }

        return breadcrumbList
      }

  }
});
